<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .main {
        margin: 0 auto;
        width: 800px;
        height: 600px;
        background-color: skyblue;
      }
    </style>
  </head>
  <body>
    <!-- 第二步 -->
    <div class="main"></div>
    <!-- 第一步 -->
    <script src="../lib/echarts.min.js"></script>
    <!-- 第三步 -->
    <script>
      const myEcharts = echarts.init(document.querySelector('.main'))
      // 第四步 指定配置项和数据(option)
      let option = {
        xAxis: {
          type: 'category',

          data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
          axisLabel: {
            color: 'rgba(255, 0, 0, 1)',
          },

          axisLine: {
            lineStyle: {
              type: 'dashed',
              color: '#000',
            },
          },
        },

        yAxis: {
          type: 'value',
          splitLine: {
            lineStyle: {
              type: 'dashed',
            },
          },
        },
        color: [
          {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 1,
                color: '#8ecde9', // 0% 处的颜色
              },
              {
                offset: 0,
                color: '#fcc0cb', // 100% 处的颜色
              },
            ],
            global: false, // 缺省为 false
          },
          {
            type: 'radial',
            x: 0.5,
            y: 0.5,
            r: 0.5,
            colorStops: [
              {
                offset: 0,
                color: 'white', // 0% 处的颜色
              },
              {
                offset: 1,
                color: 'red', // 100% 处的颜色
              },
            ],
            global: false, // 缺省为 false
          },
        ],

        series: [
          {
            data: [120, 200, 150, 80, 70, 110, 130],
            type: 'bar',
            showBackground: true,
            backgroundStyle: {
              color: 'rgba(180, 180, 180, 0.2)',
            },
          },
          {
            data: [120, 200, 150, 80, 70, 110, 130],
            type: 'bar',
            showBackground: true,
            backgroundStyle: {
              color: 'rgba(180, 180, 180, 0.2)',
            },
          },
        ],
      }

      // 第五步
      myEcharts.setOption(option)
    </script>
  </body>
</html>
